package com.shawn.model.vo;

import com.shawn.model.entity.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class NearlyUserVo implements Serializable {
    private Integer userId;
    private String avatar;
    private String nickname;

    public static NearlyUserVo init(UserInfo userInfo){
        NearlyUserVo userVo = new NearlyUserVo();
        userVo.setUserId(Math.toIntExact(userInfo.getId()));
        userVo.setAvatar(userInfo.getAvatar());
        userVo.setNickname(userInfo.getNickname());
        return userVo;
    }
}
